<link type="text/css" href="styles/pdf.css" rel="stylesheet" />
<?
$link = OpenDB();
$titulo = utf8_encode(GetValue("tituloBiopsia"));
$subtitulo = utf8_encode(GetValue("subtituloBiopsia"));
$doctor = utf8_encode(GetValue("doctor"));
$matricula1 = utf8_encode(GetValue("matricula1"));
$matricula2 = utf8_encode(GetValue("matricula2"));

function isChecked($index)
{
    $pap = $_SESSION["pap"];   
    if (isset($pap[$index])) 
        return "<img src='imagenes/checked.png' width='10' height='10' />";
    return "<img src='imagenes/unchecked.png' width='10' height='10' />";
}

function isCheckedDiag($index)
{
    global $diagnostico;
    if (isset($diagnostico[$index]))
    //return "checked='checked'";
        return "<img src='imagenes/checked.png' width='10' height='10' />";
    return "<img src='imagenes/unchecked.png' width='10' height='10' />";
}

function GetSelected($query)
{
    $result = mysql_query($query);
    if ($result && mysql_num_rows($result) > 0)
    {
        for ($i = 0; $i < mysql_num_rows($result); $i++)
        {
            $ret[mysql_result($result, $i)] = true;
        }
        return $ret;
    }
    else
        return false;
}
$protocolo = $_SESSION["protocolo"];
$query = "select id_pap, datos_clinicos from pap where numero_protocolo = " . $protocolo;
$datosPap = GetSQL($query);
$idPap = $datosPap[0]["id_pap"];
$datosClinicos = $datosPap[0]["datos_clinicos"];
$_SESSION["pap"] = GetSelected("select id_desc_microscopica from pap_desc_microscopica where id_pap = '" . $idPap . "'");
if (is_numeric($idPap))
{
    $diagnostico = GetSelected("select codigo_diagnostico_pap from pap_diagnostico_pap where id_pap = " . $idPap);
}
echo "<table><tr><td>";
include 'encabezadoInforme.php';
echo "</td></tr>";

echo "<tr><td><table cellspacing='0'>";
echo "<tr><td>Datos Cl&iacute;nicos: " . htmlentities($datosClinicos, ENT_COMPAT, "UTF-8") . "</td></tr>";
echo "<tr><td>Descripci&oacute;n Microsc&oacute;pica</td></tr></table></td></tr>";

echo "<tr><td>";
include "papStep1PDF.php";
echo "</td></tr>";
echo "<tr><td>";
include "papStep2PDF.php";
echo "</td></tr>";
echo "<tr><td>";
include "papStep3PDF.php";
echo "</td></tr></table>";
//echo "<tr><td>";
include "papDiagnosticoPDF.php";
//echo "</td></tr></table>";
CloseDB($link);
?>